package org.springframework.boot;

import org.springframework.core.env.PropertySource;
import org.springframework.core.env.SimpleCommandLinePropertySource;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.support.ResourcePropertySource;

public class Step3 {
    public static void main(String[] args) throws Exception{
        //第三步
        ApplicationEnvironment env = new ApplicationEnvironment();
        env.getPropertySources().addFirst(new SimpleCommandLinePropertySource(args));
        //第三步
        env.getPropertySources().addLast(new ResourcePropertySource(new ClassPathResource("application.properties")));
        for (PropertySource<?> ps : env.getPropertySources()) {
            System.out.println(ps);
        }
        System.out.println(env.getProperty("JAVA_HOME"));
        System.out.println(env.getProperty("server.port"));
    }
}
